package me.lijf.xapi.dto;

import lombok.Data;
import me.lijf.xapi.exception.XException;

@Data
public class RestResponse {
    private Integer code;
    private String message;
    private Object data;

    public static RestResponse fail(XException e){
        RestResponse response=new RestResponse();
        response.code=e.getCode();
        response.message=e.getMessage();
        return response;
    };

    public static RestResponse success(Object data){
        RestResponse response=new RestResponse();
        response.code=200;
        response.message="操作成功";
        response.data=data;
        return response;
    }
}
